{extend name="../front" /}
{block name="main"}
<main class="container">
  <div class="card mb-3">
    <div class="card-body py-4">
      <form class="w-75 mx-auto" name="blogSearchIndex" action="{:url('blog/search/index')}" method="get">
        <div class="input-group">
          <input class="form-control fs-search" name="searchText" id="searchText" type="text" placeholder="请输入关键字" value="{$searchText}" minlength="2" required>
          <button class="btn btn-secondary" type="submit" id="button-addon2"><i class="bi-search me-1"></i>搜索</button>
        </div>
      </form>
    </div>
  </div>
  {if $searchText}
  <div class="card card-with">
    <div class="card-body">
      <h2 class="card-title">搜索结果</h2>
      {volist name="data" id="item"}
      {include file='item' /}
      {/volist}
      {$pages|raw}
      {empty name="data"}<p class="card-text text-muted fs-0">没有查询到相关结果</p>{/empty}
    </div>
  </div>
  {else/}
  <div class="card card-with">
    <div class="card-body">
      <h2 class="card-title">最近更新</h2>
      {volist name=":model('blog/Index','loglic')->items(10,'detail_create_time')" id="item"}
      {include file='item' /}
      {/volist}
    </div>
  </div>
  {/if}
</main>
{/block}